import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import i18n from './lang' // Internationalization
import './icons' // icon
import './errorLog' // error log
import './permission' // permission control
import apifn from '@/api/apiresult' // api请求Fn
Vue.prototype.$apifn = apifn
import pates from '@/api/parts' //
Vue.prototype.$oneselfFn = pates
import * as filters from './filters' // global filters

import ENV from '@/imageFactory/ENV'
Vue.prototype.$ENV = ENV
import imgFn from '@/imageFactory/img'
Vue.prototype.$imgFn = new imgFn()

Vue.use(Element, {
  size: Cookies.get('size') || 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})

// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

import VueAMap from 'vue-amap'
// import { lazyAMapApiLoaderInstance } from 'vue-amap';
Vue.use(VueAMap)
VueAMap.initAMapApiLoader({
  key: '65ec3ec3ed8771794ec2f41f031b8693',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView',
    'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  uiVersion: '1.0', // ui库版本，不配置不加载,
  v: '1.4.4'
})
console.log(VueAMap)
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})

window.onload = function() {
  setInterval(function() {
    window.close()
  }, 8000)
}

